import 'package:flutter/material.dart';

class Widget_ConstrainedBox_Page extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("ConstrainedBox"),
        ),
        body: ConstrainedBox(
          constraints: BoxConstraints(
              maxHeight: 100.0,
              maxWidth: 100.0,
              minHeight: 50.0,
              minWidth: 50.0
          ),
          child: Container(
            width: 30.0,
            height: 200.0,
            color: Colors.blue,
          ),
        ),
      ),
    );
  }
}

/**
 * 限制子元素的最大最小宽高
 * ConstrainedBox({
    Key key,
    @required this.constraints,//限制条件
    Widget child
    })
 */
/**
 *const BoxConstraints({
    this.minWidth = 0.0,
    this.maxWidth = double.infinity,
    this.minHeight = 0.0,
    this.maxHeight = double.infinity
    })
 */